package com.yosaa.back.enums;

public enum FemaleJumpScore {
    EXCELLENT_100(100, 207, 208),
    EXCELLENT_95(95, 201, 202),
    EXCELLENT_90(90, 195, 196),
    GOOD_85(85, 188, 189),
    GOOD_80(80, 181, 182),
    PASS_78(78, 178, 179),
    PASS_76(76, 175, 176),
    PASS_74(74, 172, 173),
    PASS_72(72, 169, 170),
    PASS_70(70, 166, 167),
    PASS_68(68, 163, 164),
    PASS_66(66, 160, 161),
    PASS_64(64, 157, 158),
    PASS_62(62, 154, 155),
    PASS_60(60, 151, 152),
    FAIL_50(50, 146, 147),
    FAIL_40(40, 141, 142),
    FAIL_30(30, 136, 137),
    FAIL_20(20, 131, 132),
    FAIL_10(10, 126, 127);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    FemaleJumpScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float distance, String grade) {
        for (FemaleJumpScore standard : FemaleJumpScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (distance >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}